<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
    <script src="//layui.hcwl520.com.cn/layui/layui.js"></script>
    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
    <script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
</head>
<body>
<div id="app" style="width: 100%;height: 100%">
    <div style="width: 50%;height: 50%;float: left;border: 1px solid red">
        <div style="margin: 15px"><button type="button" class="layui-btn" @click="denji">应聘登记</button></div>
        <div style="margin: 15px"><button type="button" class="layui-btn" @click="ruzhi">入职登记</button></div>
        <div style="margin: 15px"><button type="button" class="layui-btn" @click="hebin">合成数据</button></div>
    </div>
</div>
<script>
    new Vue({
        el: '#app',
        data: {
            message: 'Hello Vue.js!',
            name:"",
            sex:"",
            school:"",
            mobile:"",
            ids:""
        },
        methods:{
            denji:function(){
              location.href = "http://127.0.0.1:8087/yinpin.html"
            },
            ruzhi:function () {
                if(getQueryVariable("ids")!=null){
                    location.href = "http://127.0.0.1:8087/ruzhi.html?ids="+getQueryVariable("ids");
                }else {
                    laylayer.msg('请先做应聘登记！');
                }
                axios({
                    method: 'post',
                    url: 'http://127.0.0.1:8087/Ding/sendsh',
                    params: {
                        name: this.name,
                        sex: this.sex,
                        school: this.school,
                        mobile: this.mobile
                    }
                }).then(function(data) {
                    console.log("ids"+data.data.ids)
                    this.ids = data.data.ids;
                    location.href = "http://127.0.0.1:8087/test.html?ids="+data.data.ids;
                });
            },
            hebin:function () {
                if(getQueryVariable("idTwo")!=null){
                   console.log(getQueryVariable("idTwo"))
                    this.ids = getQueryVariable("idTwo");
                    axios({
                        method: 'post',
                        url: 'http://127.0.0.1:8087/Ding/findHe',
                        params: {
                            idTwo: this.ids
                        }
                    }).then(function(data) {
                        console.log("map"+JSON.stringify(data.data.ids))
                        // this.ids = data.data.ids;
                        location.href = "http://127.0.0.1:8087/hebing.html?map="+data.data.ids;
                    });
                }else {
                    laylayer.msg('请先完成以上流程！');
                }
            }
        }
    })
    function getQueryVariable(variable)
    {
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i=0;i<vars.length;i++) {
            var pair = vars[i].split("=");
            if(pair[0] == variable){return pair[1];}
        }
        return(false);
    }
    layui.use('form', function(){
        var form = layui.form;

    });
</script>
</body>
</html>